Skip to content

fix: update video orientation handling in CameraView for session readiness - #64

Merged
pushpender-singh-ap merged 4 commits into
mainfrom
fix/62
Nov 25, 2025
Merged

fix: update video orientation handling in CameraView for session readiness#64
pushpender-singh-ap merged 4 commits into
mainfrom
fix/62

Conversation

@pushpender-singh-ap

@pushpender-singh-ap pushpender-singh-ap commented Nov 25, 2025

Copy link
Copy Markdown
Owner

This pull request improves how the camera preview layer's video orientation is managed in the CameraView class. Instead of always setting the orientation to portrait, the code now dynamically updates the video orientation based on the device's current orientation. This ensures the camera preview adapts correctly when the device is rotated.

Camera preview orientation improvements:

  • Replaced hardcoded .portrait video orientation assignments with calls to the new updateVideoOrientation() method in session setup callbacks, enabling dynamic orientation updates. (ios/CameraView.swift) [1] [2]
  • Added the updateVideoOrientation() method, which sets the preview layer's video orientation according to the device's orientation, supporting portrait, landscape left/right, and upside-down modes. (ios/CameraView.swift)
  • Invoked updateVideoOrientation() in layoutSubviews to ensure the preview layer orientation updates whenever the view's layout changes, such as during device rotation. (ios/CameraView.swift)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances camera preview orientation handling in CameraView to dynamically adapt to device rotation. Instead of hardcoding the preview layer to portrait orientation, the code now responds to the device's current orientation state.

  • Introduced updateVideoOrientation() method to set preview layer orientation based on device orientation
  • Replaced hardcoded .portrait assignments with dynamic orientation updates
  • Added orientation updates in layoutSubviews() to handle rotation events

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Comment thread ios/CameraView.swift Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Comment thread ios/CameraView.swift Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Comment thread ios/CameraView.swift
Comment thread ios/CameraView.swift
Comment thread ios/CameraView.swift Outdated
Comment thread ios/CameraView.swift
Comment thread ios/CameraView.swift
Comment thread ios/CameraView.swift
@pushpender-singh-ap
pushpender-singh-ap merged commit 88b48dd into main Nov 25, 2025
6 checks passed
@pushpender-singh-ap
pushpender-singh-ap deleted the fix/62 branch November 25, 2025 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CameraView shows flipped/rotated camera image in landscape mode on iOS

2 participants